That error is because t1 declared: Test t1(); is not an Test instance.
If you use Test t1; //without () it would work.
LE: stampede was faster
The empty parentheses for default constructor can be used when you create objects on the heap, so:
Isn't C++ a beautiful language?Qt Code:
Test *ptr = new Test(); //is ok //so is this Test *ptr = new Test; //ok tooTo copy to clipboard, switch view to plain text mode
Bookmarks